package com.example.caoben_back.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.caoben_back.entity.po.Post;
import com.example.caoben_back.mapper.PostMapper;
import com.example.caoben_back.service.IPostService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 存储论坛帖子信息 服务实现类
 * </p>
 *
 * @author ylsink
 * @since 2025-11-05
 */
@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IPostService {

    @Override
    public List<Post> getHotPosts(int page, int size) {
        // 简单实现：按回复数和点赞数综合排序获取热门帖子
        // 实际项目中可以根据更复杂的算法来计算热度
        return this.baseMapper.selectHotPosts((page - 1) * size, size);
    }
}